(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.category.cate.cateViewController', viewController);
	viewController.$inject = [ '$scope', '$q', 'Constants', 'gridService', 'modalService', 'layoutConfig', 'validatorConfig', 'authService'];
	function viewController($scope, $q, Constants, gridService, modalService, layoutConfig, validatorConfig, authService) {
		var ctrl = this, log = $scope.loggerFactory.getLogger("cateView");
		var cateInfo = $scope.$stateParams.params;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.cateInfo = cateInfo;
		ctrl.limitCategory = {};
		ctrl.init = function() {			
			var params = {
					limitCatId : cateInfo.id || cateInfo.limitCatId
				};			
			return authService.view(params).then(function(response) {
				ctrl.limitCategory = response.data || cateInfo;
			}, angular.noop);
		};
		
		ctrl.create = function() {
			$scope.go('cda.category.cate.nodeCreate', ctrl.cateInfo);
		};
		ctrl.update = function() {
			$scope.go('cda.category.cate.cateUpdate', ctrl.cateInfo);
		};
		ctrl.delete = function() {
			$scope.go('cda.category.cate.cateDelete', ctrl.cateInfo);
		};
		
		ctrl.toCategoryList = function(){
			$scope.go('cda.category.cate.cateCreate');
		};
		
	}
})(angular);